import Cookies from 'js-cookie'
import CONSTANTS from '@/config/constants'
import util from '@/libs/util'
import mixin from '../mixin'

export default {
    props: ['baseuser'],
    mixins: [mixin],
    data() {
        return {
            generateData: {
                templateIndex: -1
            },
            templates: [],
            imageDomain: CONSTANTS.SERVER_HOST
        }
    },
    mounted() {
        this.loadTemplates()
    },
    methods: {
        async loadTemplates() {
            this.showLoading()
            const res = await util.ajax.post(CONSTANTS.TEMPLATE_LIST, util.toFormData({
                organizeid: (this.baseuser.type === 2 ? this.baseuser.orgId : '')
            }))
            this.templates = res.data.data
            this.$Spin.hide()
        }
    },
    computed: {
    },
    beforeDestroy() {
    }
};